package com.lagou.demo.controller;

import com.lagou.demo.service.IDemoService;
import com.lagou.edu.mvcframework.annotations.LagouAutowired;
import com.lagou.edu.mvcframework.annotations.LagouController;
import com.lagou.edu.mvcframework.annotations.LagouRequestMapping;
import com.lagou.edu.mvcframework.annotations.Security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@LagouController
@LagouRequestMapping("/demo")
@Security({"Goddess"})
public class DemoController {


    @LagouAutowired
    private IDemoService demoService;


    /**
     * URL: http://localhost:8080/demo/get?username=lisi
     * @param request
     * @param response
     * @param username
     * @return
     */
    @LagouRequestMapping("/get")
//    @Security({"zhangsan", "lisi", "wangwu"})
    public String get(HttpServletRequest request, HttpServletResponse response,String username) {
        return demoService.get(username);

    }

    @LagouRequestMapping("/get2")
    @Security({"zhangsan", "lisi"})
    public String get2(String username) {
        return demoService.get2(username);

    }

    @LagouRequestMapping("/get3")
    @Security({"lisi"})
    public String get3(String username) {
        return demoService.get3(username);

    }
}
